<template>
    <div>
        <p ref="msg">{{name}}</p>
        <button type="button" @click="setName">修改名字</button>
    </div>
</template>

<script>
  export default {
    name: 'nexttick',
    data(){
      return {
        name:"张三"
      }
    },
    created(){
      this.$nextTick(()=>{
        console.log(this.$refs['msg'].innerHTML);
      })
    },
    methods:{
      setName(){
        this.name="李四";
        this.$nextTick(()=>{
          console.log(this.$refs['msg'].innerHTML)
        })

      }
    }
  };
</script>

<style scoped>

</style>
